package com.zsj.juc.funny;

import java.util.concurrent.TimeUnit;

/**
 * @author zsj
 * @version 1.0
 * @date 2024/4/24 16:24
 * @description
 */
public class finallyTest {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new A(), "test");
        thread.setDaemon(true);
        thread.start();
        //思考a中的哈哈哈会被打印吗？
    }

    public static class A implements Runnable {
        public A() {
        }

        @Override
        public void run() {
            try {
                try {
                    TimeUnit.MILLISECONDS.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            } finally {
                System.out.println("哈哈哈哈");
            }
        }
    }
}
